<?php

class m120618_004136_spec extends CDbMigration
{
	public function up()
	{
	    $pk = "int(11) NOT NULL";
	    
	    $this->createTable('Specialization', array(
            'id' => $pk . ' PRIMARY KEY AUTO_INCREMENT',
            'name' => 'string',
        ), 'ENGINE=InnoDB');

	    $this->addColumn('User', 'specializationId', 'int(11)');
	    
	    $this->addForeignKey('fk_User_Spec', 'User',
	            'specializationId', 'Specialization', 'id');
	}

	public function down()
	{
		$this->dropForeignKey('fk_User_Spec', 'User');
		$this->dropColumn('User', 'specializationId');
		$this->dropTable('Specialization');
	}

}